﻿using System.Collections.Generic;
using UnityEngine;

/**
 * 表现实体控制器抽象基类
 */
public abstract class Controller : MonoBehaviour{
    public Animator anim;

    public CharacterController ctrl;

    public Transform hpRoot;

    private Vector2 dir = Vector2.zero;
    protected bool isMove = false;

    public Vector2 Dir{
        get{ return dir; }
        set{
            if (value == Vector2.zero){
                isMove = false;
            }
            else{
                isMove = true;
            }

            dir = value;
        }
    }

    protected Dictionary<string, GameObject> fxDic = new Dictionary<string, GameObject>();

    protected TimerSvc timerSvc;

    protected bool skillMove = false;

    protected float skillMoveSpeed = 0f;

    public virtual void Init(){
        timerSvc = TimerSvc.Instance;
    }
    
    public virtual void SetBlend(float blend){
        anim.SetFloat("Blend", blend);
    }

    public virtual void SetAction(int act){
        anim.SetInteger("Action", act);
    }
    
    public virtual void SetFx(string name, float destroy){
        
    }

    public void SetSkillMoveState(bool move, float skillSpeed = 0f){
        skillMove = move;
        skillMoveSpeed = skillSpeed;
    }
}
